/*
 * Copyright (C) 2016 yixun All Rights Reserved.
 * 
 * SalesStatusEnum.java
 */
package com.emm.yixun.common.model.enums;
import java.io.Serializable;
import org.apache.commons.lang.StringUtils;
/**
 * 业务标志
*/
public enum BusinessFlagEnum implements Serializable{
	    BUSINESSFLAG_1("1","收认筹金",null),
	    BUSINESSFLAG_2("2","认筹金转认购金[转出]",null),
	    BUSINESSFLAG_3("3","认筹金转签约金[转出]",null),
	    BUSINESSFLAG_4("4","退认筹金",null),
	    BUSINESSFLAG_5("5","收认购金",null),
	    BUSINESSFLAG_6("6","认购金转签约金[转出]",null),
	    BUSINESSFLAG_7("7","认筹金转认购金[转入]",null),
	    BUSINESSFLAG_8("8","退认购金",null), 
	    BUSINESSFLAG_9("9","收签约金",null),
	    BUSINESSFLAG_10("10","认筹金转签约金[转出]",null),
	    BUSINESSFLAG_11("11","POS手续费",null),
	    BUSINESSFLAG_12("12","认筹金转签约金[转入]",null),
	    BUSINESSFLAG_13("13","认购金转签约金[转入]",null),
	    BUSINESSFLAG_14("14","退签约金",null),
	    BUSINESSFLAG_15("15","补差款",null),
	    BUSINESSFLAG_16("16","退手续费",null),
	    BUSINESSFLAG_17("17","认购金内部转账[转出]",null),
	    BUSINESSFLAG_18("18","认购金内部转账[转入]",null),
	    BUSINESSFLAG_19("19","装修款",null)
		;
		
		private final String no;
		private final String des;
		private final Enum parent;
		
		/**
		 * 私有构造函数
		 * @param code
		 * @param description
		 */
		BusinessFlagEnum(String no, String des,Enum parent) {
			this.no = no;
			this.des = des;
			this.parent = parent;
		}

		/**
		 * @return Returns the no.
		 */
		public String getNo() {
			return no;
		}

		/**
		 * @return Returns the des.
		 */
		public String getDes() {
			return des;
		}
		
		/**
		 * @return Returns the parent.
		 */
		public Enum getParent() {
			return parent;
		}

		/**
		 * 通过枚举<code>des</code>获得枚举
		 * 
		 * @param des
		 * @return
		 */
		public static BusinessFlagEnum getByDescription(String des) {
			if(StringUtils.isBlank(des)){
				return null;
			}
			for (BusinessFlagEnum menum : values()) {
				if (menum.getDes().equals(des)) {
					return menum;
				}
			}
			return null;
		}
		public static BusinessFlagEnum getByNo(String no) {
			if(StringUtils.isBlank(no)){
				return null;
			}
			for (BusinessFlagEnum menum : values()) {
				if (menum.getNo().equals(no)) {
					return menum;
				}
			}
			return null;
		}
}
